<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XXTEA 测试</title>
<script type="text/javascript">
var data;
function encrypt() {
    start = (new Date()).getTime();
    data = document.forms['f'].encrypt_text.value = xxtea_encrypt(utf16to8(document.forms['f'].plain_text.value), '1234567890abcdef');
    end = (new Date()).getTime();
    alert(end - start);
}
function decrypt() {
    start = (new Date()).getTime();
    document.forms['f'].decrypt_text.value = utf8to16(xxtea_decrypt(data, '1234567890abcdef'));
    end = (new Date()).getTime();
    alert(end - start);
}
</script>
</head>
<body>

<script type="text/javascript" src="utf.js"></script>
<script type="text/javascript" src="xxtea.js"></script>
<form name="f">
<textarea id="plain_text" name="plain_text" cols="80" rows="25"></textarea>
<input type="button" onclick="encrypt();" value="加密" /><br />
<textarea id="encrypt_text" name="encrypt_text" cols="80" rows="25"></textarea>
<input type="button" onclick="decrypt();" value="解密" /><br />
<textarea id="decrypt_text" name="decrypt_text" cols="80" rows="25"></textarea>
</form>
</body>
</html>